#ifndef _FREETYPE2_H
#define _FREETYPE2_H

#include <string>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H

namespace FT
{
/**
 * @brief The ft2exception class
 */
class ft2exception
{
public:
    ft2exception(std::string msg):msg(msg){}
    ft2exception(const ft2exception &other)
    {
        this->msg = other.msg;
    }
    std::string what()
    {
        return msg;
    }
private:
    std::string msg;
};
/**
 * @brief The FreeType2 class
 */
class FreeType2
{
public:
    static void InitLibrary() throw (ft2exception)
    {
        FT_Error error;
        error = FT_Init_FreeType(&library);
        if(error)
        {
            throw ft2exception(std::string("FT_Init_FreeType failed."));
        }
        _initialized = true;
    }
    static bool initialized()
    {
        return FT::FreeType2::_initialized;
    }
    static FT_Library getLibrary()
    {
        return FT::FreeType2::library;
    }
private:
    static FT_Library  library;
    static bool _initialized;
};

}
#endif // FREETYPE2_H
